<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>商品列表</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../css/aui-flex.css"/>
    <style>
        body {
            background: #f3f3f3;
        }

        li {
            width: 50%;
        }
    </style>
</head>
<body>
<div class="aui-content-padded contain gongchang">
    <ul class=" " id="proList-content">

    </ul>
</div>

<script id="proList-template" type="text/x-dot-template">
    {{ for(var i in it){ }}
    {{##def.snippet:
    {{#def.proList}}
    #}}
    {{#def.snippet}}
    {{}}}
</script>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script type="text/javascript" src="../script/template.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/jquery-1.11.3.js"></script>
<script type="text/javascript">
    var isLock = false, page = 1, goodsType = 1;

    apiready = function () {
        api.parseTapmode();
        searchValue = api.pageParam.searchValue
//        showLoadingMo();


        getList();

        api.addEventListener({
            name: 'scrolltobottom'
        }, function (ret, err) {
            page++;
            getList();
        });

        //重新登录监听
        api.addEventListener({
            name: 'reGetMyInfo'
        }, function (ret) {
            if (ret && ret.value) {
                page = 1;
                isLock = false;
                getData();
            }
        });


    }
    function getList() {
        var url = "search/goods";
        var data = {};
        data.keyword = "饼";
        data.page = page;

        ajaxRequest(url, 'get', data, function (ret, err) {
            var $content = $('#proList-content');
            var $tpl =$('#proList-template').text();
            var tempFn = doT.template($tpl, undefined, proListTemplates2);
            var data=tempFn(ret.data)
            if(page>1){
                if (!$.trim(ret.data)) {
                    return;
                }
                $content.append(data);
            }else{
                if (!$.trim(ret.data)) {

                    $content.html('<div class="kongshuju">' +
                        // '<img src="../image/not-data.png" style="" >'+
                        '<p>暂无数据</p></div>');
                }else{
                    $content.html(data);
                }
            }
//            $api.html(content, '');
//            $api.html(content, tempFn(ret.data));
        });
    }
</script>
</html>